package com.example.demo810.biz;

import com.example.demo810.po.SysUser;
import com.example.demo810.repo.UserRepo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Service;

/**
 * @author lzh
 * @date 2020/8/10 - 10:47
 */
@Service
public class SysUserService {

    @Autowired
    UserRepo userRepo;

    public void insert(SysUser user){
        userRepo.save(user);
    }

    public SysUser findByUserName(String username){
        return   userRepo.findOne(Example.of(SysUser.builder()
                .username(username)
                .build())).orElse(null);
    }
}
